/*
 * Copyright 2018-10-18 13:27:50 The JA-SIG Collaborative. All rights reserved.
 * distributed with thi file and available online at
 */
package com.lap.scp.erp.core.impl;

import java.util.Collections;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.lap.scd.commons.core.exception.ManagerException;
import com.lap.scd.commons.page.Page;
import com.lap.scp.erp.core.SellOrdersManager;
import com.lap.scp.erp.dal.SellOrdersDAO;
import com.lap.scp.erp.domain.SellOrdersDO;
import com.lap.scp.erp.query.SellOrdersQueryVO;

/**
 * <pre>
 * 物料出库单，记录物料出库的信息业务代码默认实现类，这里提供最小元素原子操作，所以尽量少在该类中做流程代码。
 * 业务流程代码应该写在AO中。
 * </pre>
 * 
 * @author 劳水生 Exp
 * @Date 2018-10-18 13:27:50
 * @since 2.0.0
 */
@Service("sellOrdersManager")
public class DefaultSellOrdersManager implements SellOrdersManager {
	/**
	 * 物料出库单，记录物料出库的信息数据操作对象
	 */
	@Resource
	private SellOrdersDAO sellOrdersDAO;

	@Override
	public List<SellOrdersDO> queryPage(Page page, SellOrdersQueryVO queryVO) throws ManagerException {
		int count = sellOrdersDAO.countPage(queryVO);
		if (count == 0) {
			return Collections.emptyList();
		} else {
			page.setTotalItem(count);
			return sellOrdersDAO.queryPage(page, queryVO);
		}
	}

}
